﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data.SqlClient;
using System.Text;
using System.Threading.Tasks;
using Dapper;
using DataModel;
using ServiceStack.Redis;

namespace YUE.BA.DataAccess
{
    public class Class1
    {
        public User GetUser(Guid id)
        {
            SqlConnection sql=new SqlConnection("");
            string host = "localhost";
            using (RedisClient redisClient = new RedisClient(host))
            {
                var model = redisClient.Get<User>(id.ToString());
                if (model == null)
                {
                    model=SqlMapper.Query<User>(sql, "").SingleOrDefault();
                }
                return model;
            }
        }
    }
}
